answersLogoWhite

0

AllQ&AStudy Guides
Best answer

_node* search (_node* head, _key key) {

_node* node;

for (node=head; node != NULL;;) {

if (key == node->key) return node;

else if (key < node.>key) node = node->left;

else node = node->right;

}

return node;

}

This answer is:
Related answers

_node* search (_node* head, _key key) {

_node* node;

for (node=head; node != NULL;;) {

if (key == node->key) return node;

else if (key < node.>key) node = node->left;

else node = node->right;

}

return node;

}

View page

for (node=head; node!=null; node=node->next) printnode(node);

View page

Refer to http://cslibrary.stanford.edu/110/BinaryTrees.html

void mirror(struct node* node) {

if (node==NULL) {

return;

}

else {

struct node* temp; // do the subtrees

mirror(node->left);

mirror(node->right); // swap the pointers in this node

temp = node->left;

node->left = node->right;

node->right = temp;

}

}

View page

Yes. The tail node's next node is the head node, while the head node's previous node is the tail node.

View page

Given a list and a node to delete, use the following algorithm:

// Are we deleting the head node?

if (node == list.head)

{

// Yes -- assign its next node as the new head

list.head = node.next

}

else // The node is not the head node

{

// Point to the head node

prev = list.head

// Traverse the list to locate the node that comes immediately before the one we want to delete

while (prev.next != node)

{

prev = prev.next;

}

end while

// Assign the node's next node to the previous node's next node

prev.next = node.next;

}

end if

// Before deleting the node, reset its next node

node.next = null;

// Now delete the node.

delete node;

View page
Featured study guide

Disadvantages of SSDs.

Advantages of HDDs.

Disadvantages of Magnetic Tape

➡️
See all cards
4.16
80 Reviews
More study guides
5.0
1 Review

No Reviews
Search results